using System;
using Server.Items;
using Server.Network;
using Server.Mobiles;

namespace Server.Items
{
    public class NoticeClue : Item
	{
		public override bool HandlesOnMovement{ get{ return true; } }

		private DateTime m_NextTalk;
		public DateTime NextTalk{ get{ return m_NextTalk; } set{ m_NextTalk = value; } }

		public override void OnMovement( Mobile m, Point3D oldLocation )
		{
			if( m is PlayerMobile )
			{
				if ( DateTime.Now >= m_NextTalk && Utility.InRange( m.Location, this.Location, 2 ) ) // DISTANCE TRIGGERED
				{
					m.PrivateOverheadMessage(MessageType.Regular, 1150, false, this.Name, m.NetState);
					m_NextTalk = (DateTime.Now + TimeSpan.FromSeconds( 30 )); // TIME BETWEEN THAT THE TILE MAKES A NEARBY MOVING PLAYER GET THE MESSAGE
				}
			}
		}

		[Constructable]
		public NoticeClue( ) : base( 0x181E )
		{
			Movable = false;
			Visible = false;
			Name = "clue"; // CHANGE THE NAME AFTER PLACING THE OBJECT "IN GAME" TO WHATEVER YOU WANT TO APPEAR OVER THE TOP OF THE PLAYER THAT TRIGGERS IT
		}

		public NoticeClue( Serial serial ) : base( serial )
		{
		}

		public override void Serialize(GenericWriter writer)
		{
			base.Serialize(writer);
			writer.Write((int) 0);
		}

		public override void Deserialize(GenericReader reader)
		{
			base.Deserialize(reader);
			int version = reader.ReadInt();
		}
	}	
}